package org.nstack.network.service.flat;

import org.nstack.network.service.vip.VipBaseBackend;
import org.nstack.network.service.vip.VipFactory;
import org.nstack.network.service.vip.VipVO;
import org.nstack.header.core.Completion;
import org.nstack.header.message.Message;


public class FlatVipFactory implements VipFactory {
    @Override
    public String getNetworkServiceProviderType() {
        return FlatNetworkServiceConstant.FLAT_NETWORK_SERVICE_TYPE_STRING;
    }

    @Override
    public VipBaseBackend getVip(VipVO self) {
        return new VipBaseBackend(self) {
            @Override
            protected void releaseVipOnBackend(Completion completion) {

                completion.success();
            }

            @Override
            protected void acquireVipOnBackend(Completion completion) {

                completion.success();
            }

            @Override
            protected void handleBackendSpecificMessage(Message msg) {
                bus.dealWithUnknownMessage(msg);
            }
        };
    }
}
